Popular Searches
Popular Course Categories
Popular Courses

Creating Bar Charts

Basic Data Visualization

Creating Bar Charts in Tableau

Topic: Creating Bar Charts in Tableau

Learning Objective: Learn how to create vertical and horizontal bar charts, compare values across categories, customize charts using the Marks card, sort data, add labels, create stacked and side-by-side bar charts, and interpret business insights.

Tableau Course: JustAcademy Tableau Training

Course Demo: Register for a Tableau Course Demo


1. Introduction to Bar Charts

A bar chart is a data visualization that uses rectangular bars to represent numerical values across different categories. The length or height of each bar represents the value of a measure, making it easy to compare categories and identify the highest or lowest values.

In Tableau, bar charts are commonly used to analyze sales by product, profit by region, revenue by department, customer counts by segment, and many other business metrics.

A bar chart generally contains a categorical dimension and a numerical measure. For example, Category can represent the products being compared, while Sales represents their numerical values.

Example

Product Category Total Sales
Furniture 45,000
Office Supplies 30,000
Technology 60,000

From this example, Technology has the highest sales, followed by Furniture and Office Supplies. A bar chart makes this comparison easier to understand than reading the numbers individually.

2. Why Are Bar Charts Important?

Bar charts are useful because they convert numerical data into a visual format that is easy to compare and interpret.

  • Category comparison: Compare sales, profit, revenue, or quantity across categories.
  • Performance analysis: Identify the best-performing and lowest-performing products or departments.
  • Ranking: Arrange categories from highest to lowest values.
  • Business reporting: Present key performance indicators in dashboards and reports.
  • Regional analysis: Compare performance across cities, states, or regions.
  • Product analysis: Identify products contributing the most or least to revenue.
  • Decision-making: Help teams determine where to focus resources and attention.

3. Understanding the Main Components of a Bar Chart

Component Description Example
Dimension Defines the categories being compared Region, Category, Product
Measure Provides the numerical value represented by each bar Sales, Profit, Quantity
Bars Represent the values for categories A bar for each region
Axis Shows the scale of numerical values or category labels Sales from 0 to 100,000
Labels Display numerical values or other text on marks 60,000 above a bar
Color Distinguishes categories or represents a measure Different colors for regions
Tooltip Shows additional information when hovering over a bar Sales, profit, and category

4. Types of Bar Charts in Tableau

4.1 Vertical Bar Chart

A vertical bar chart displays bars extending upward from the horizontal axis. Categories generally appear along the horizontal axis, while numerical values appear along the vertical axis.

Example: Compare total sales across Furniture, Office Supplies, and Technology.

Common use: Comparing a manageable number of categories when vertical bars and category labels are easy to read.

4.2 Horizontal Bar Chart

A horizontal bar chart displays bars extending from left to right. Categories generally appear on the vertical axis, while numerical values appear on the horizontal axis.

Example: Compare sales across different regions.

Common use: Comparing many categories or displaying long category names.

4.3 Stacked Bar Chart

A stacked bar chart divides each bar into colored segments representing subcategories. The segments combine to show the overall total for each main category.

Example: Show total regional sales divided into Furniture, Office Supplies, and Technology.

Common use: Comparing totals while also examining the contribution of subcategories. Individual segment comparisons can be harder when segments do not share a common baseline.

4.4 Side-by-Side Bar Chart

A side-by-side bar chart, also called a grouped bar chart, displays bars next to each other for multiple subcategories within a main category.

Example: Compare Furniture, Office Supplies, and Technology sales for each region using adjacent bars.

Common use: Comparing subcategories across groups when direct comparisons between individual values are important.

4.5 100% Stacked Bar Chart

A 100% stacked bar chart represents each main category as a total of 100%. Each colored segment shows the percentage contribution of a subcategory.

Example: Compare the percentage of sales contributed by each product category across regions.

Common use: Comparing proportions when the total size of each category is less important than the composition.

5. Understanding Dimensions and Measures

To create a bar chart, you generally need a dimension to define the categories and a measure to provide the numerical values.

Dimensions

Dimensions describe or categorize data. They commonly contain names, groups, dates, or labels.

  • Category
  • Sub-Category
  • Region
  • Product Name
  • Customer Segment
  • Department

Measures

Measures contain numerical values that can be aggregated, such as sales, profit, cost, and quantity.

  • Sales
  • Profit
  • Quantity
  • Revenue
  • Discount
  • Order Count

For example, placing Category on Columns and Sales on Rows can create a vertical bar chart. Reversing the arrangement by placing Category on Rows and Sales on Columns can create a horizontal bar chart.

6. Preparing Data for a Bar Chart

Before creating a chart, make sure the dataset contains the necessary fields and that the values are suitable for comparison.

Example Dataset

Order ID Region Category Sales Profit
1001 East Furniture 12,000 2,000
1002 West Technology 25,000 6,000
1003 North Office Supplies 8,000 1,500
1004 South Furniture 15,000 3,000
1005 East Technology 30,000 7,000

Note: The dataset above is illustrative and is intended for learning purposes.

Data Preparation Checklist

  • Confirm that the dimension contains meaningful category values.
  • Confirm that the measure contains appropriate numerical values.
  • Check for missing or invalid values.
  • Verify the data type of each field.
  • Understand whether the measure should be summed, averaged, counted, or otherwise aggregated.
  • Check whether duplicate records or data-quality problems could affect the results.

7. How to Create a Basic Bar Chart in Tableau

Follow these steps to create a basic bar chart using a dimension and a measure.

  1. Open Tableau Desktop or a supported Tableau web authoring environment.
  2. Connect to a dataset, such as an Excel workbook or a supported database.
  3. Open a new worksheet.
  4. Locate the Data pane.
  5. Drag the Category dimension to Columns.
  6. Drag the Sales measure to Rows.
  7. Review the generated visualization.
  8. If necessary, select Bar from the Marks card drop-down menu.
  9. Check that the measure is aggregated appropriately, for example as SUM(Sales).
  10. Adjust the chart title, labels, sorting, and formatting.
  11. Save the workbook.

Expected Result

A vertical bar chart should appear, with category names along the horizontal axis and sales values along the vertical axis.

Tableau may choose a different mark type depending on the fields and configuration. If necessary, explicitly choose Bar from the Marks card or use the Show Me panel.

8. Creating a Vertical Bar Chart

A vertical bar chart is suitable when you want to compare values across categories and the category labels fit comfortably along the horizontal axis.

Steps

  1. Open a new worksheet.
  2. Drag Category to Columns.
  3. Drag Sales to Rows.
  4. Choose Bar on the Marks card if needed.
  5. Drag Sales to Label if you want to show the values on the bars.
  6. Use the Sort option to arrange categories in a useful order.
  7. Add a clear title, such as "Sales by Product Category".

Business Question

Which product category generates the highest sales?

Interpretation: Compare the height of the bars. The tallest bar represents the category with the greatest sales value, assuming the same scale and aggregation are used for all categories.

9. Creating a Horizontal Bar Chart

Horizontal bar charts are especially useful when category names are long or when you need to compare a large number of categories.

Steps

  1. Open a new worksheet.
  2. Drag Region to Rows.
  3. Drag Sales to Columns.
  4. Choose Bar on the Marks card if necessary.
  5. Sort the bars by sales.
  6. Drag Sales to Label if you want to display values.
  7. Add a suitable chart title, such as "Sales by Region".

Business Question

Which region contributes the most sales?

Interpretation: The longest bar represents the region with the greatest sales value. Sorting from highest to lowest makes the ranking easier to identify.

10. Creating a Stacked Bar Chart

A stacked bar chart displays a total divided into segments. Each segment represents a component of the total, allowing you to compare both overall values and their composition.

Example

Suppose a business wants to analyze sales by region and product category. It wants to see the total sales for each region and how each product category contributes to that total.

Steps

  1. Drag Region to Columns.
  2. Drag Sales to Rows.
  3. Choose Bar on the Marks card.
  4. Drag Category to Color on the Marks card.
  5. Review the colored segments within each regional bar.
  6. Check the color legend to identify the product categories.
  7. If needed, review the Analysis menu's Stack Marks setting to confirm that marks are stacked.

Benefits

  • Shows the total sales for each region.
  • Shows how product categories contribute to regional sales.
  • Supports analysis of sales composition.

Limitation

Comparing individual segments can be difficult when they do not share the same baseline. Use a side-by-side chart if accurate comparisons between individual subcategory values are the main goal.

11. Creating a Side-by-Side Bar Chart

A side-by-side bar chart separates subcategory bars within each main category. It is useful for comparing several measures or groups directly.

Steps

  1. Drag Region to Columns.
  2. Drag Sales to Rows.
  3. Choose Bar from the Marks card if needed.
  4. Drag Category to Columns and place it next to Region to create grouped headers.
  5. Alternatively, use a suitable arrangement of Region and Category on the shelves and adjust the view as needed.
  6. Review the resulting grouped bars.
  7. Use Color to distinguish the categories when helpful.

The exact shelf arrangement can vary depending on which field should define the primary grouping. The goal is to display separate bars for each subcategory within each main group.

Business Question

How does each product category perform within each region?

Interpretation: Compare bars within the same region and compare the same category across different regions.

12. Creating a 100% Stacked Bar Chart

A 100% stacked bar chart compares proportions rather than raw totals. Every bar represents 100%, and each segment represents the percentage contribution of a subcategory.

Steps

  1. Create a stacked bar chart using a main dimension, a measure, and a subcategory on Color.
  2. Right-click the measure in the view or use its pill menu.
  3. Choose Quick Table Calculation and select Percent of Total when appropriate.
  4. Configure the calculation so the percentages are computed across the intended subcategories within each main category.
  5. Format the measure as a percentage.
  6. Verify that the segments in each bar add up to approximately 100%.

Important: Percent of Total can be calculated across different directions or partitions. Check the table calculation settings to ensure the percentages are computed within the intended groups.

13. Sorting Bar Charts in Tableau

Sorting arranges categories according to a meaningful order. It helps users quickly identify the highest and lowest values.

Common Sorting Options

  • Ascending: Arranges values from smallest to largest.
  • Descending: Arranges values from largest to smallest.
  • Alphabetical: Arranges category names alphabetically.
  • Manual: Allows categories to be arranged in a chosen order.

Steps to Sort a Bar Chart

  1. Create a bar chart.
  2. Select the dimension in the view or on the relevant shelf.
  3. Use the toolbar's sort controls or open the dimension's menu.
  4. Choose the appropriate sort direction.
  5. If necessary, open the Sort settings and sort by the measure, such as SUM(Sales).

Best practice: For ranking charts, descending order is often useful because it places the largest values first. Alphabetical order may be better when users need to find specific categories.

14. Adding Data Labels to Bar Charts

Data labels display numerical values directly on or near the bars. They make exact values easier to read without requiring users to hover over every mark.

Steps

  1. Create a bar chart.
  2. Open the Marks card.
  3. Click Label.
  4. Enable Show Mark Labels, or drag the measure to Label.
  5. Adjust font, alignment, and number formatting as needed.
  6. Check that the labels do not overlap or become truncated.

When Should You Use Labels?

  • When the chart contains a small or moderate number of bars.
  • When exact values are important to the audience.
  • When the chart will be viewed in a presentation or report.

Avoid labeling every mark if the chart is crowded. Tooltips can provide additional values when users hover over a bar.

15. Customizing Bar Colors

Color can make a bar chart easier to understand when it is used purposefully. You can assign a single color to all bars, distinguish categories using a dimension, or use a continuous color scale for a measure.

Steps to Change Bar Color

  1. Open the Marks card.
  2. Click Color to choose a uniform color or adjust the palette.
  3. To color bars by a category, drag a dimension such as Region to Color.
  4. To encode a numerical measure, drag a measure such as Profit to Color.
  5. Review the legend and adjust the colors if needed.

Color Best Practices

  • Use consistent colors across related worksheets.
  • Use distinct colors for categories that need to be differentiated.
  • Use a suitable sequential or diverging palette for numerical values.
  • Avoid giving every bar a different color without a meaningful reason.
  • Use colors that are accessible and easy to distinguish.

16. Using Tooltips in Bar Charts

Tooltips provide additional information when users hover over a bar. They are useful for keeping the chart simple while still allowing detailed exploration.

Steps

  1. Create a bar chart.
  2. Drag additional fields, such as Profit or Region, to Tooltip on the Marks card.
  3. Click Tooltip to edit the displayed text.
  4. Arrange the fields in a clear format.
  5. Hover over several bars to test the results.

Example Tooltip

Region: West
Category: Technology
Total Sales: 60,000
Total Profit: 12,000

The values above are illustrative. The tooltip displays the actual values from the connected dataset and current view.

17. Formatting a Bar Chart

Formatting improves the chart's readability and professional appearance.

Important Formatting Options

  • Chart title: Use a descriptive title that explains the comparison.
  • Axis titles: Clearly identify the numerical measure and its units.
  • Number format: Use currency, percentages, or appropriate numeric formats.
  • Bar size: Adjust the size using the Size option on the Marks card where appropriate.
  • Gridlines: Reduce unnecessary gridlines while retaining useful reference lines.
  • Fonts: Use readable text sizes and consistent typography.
  • Spacing: Leave enough space between bars and category labels.
  • Legends: Keep color legends clear and relevant.

Example of a Good Title

Instead of using a generic title such as "Sheet 1", use a title such as "Total Sales by Product Category".

18. Understanding Aggregation in Bar Charts

Tableau commonly aggregates measures when they are placed in a view. The aggregation determines the numerical value represented by each bar.

Aggregation Meaning Example
SUM Adds the values Total sales by region
AVG Calculates the average Average order value by region
MIN Returns the smallest value Minimum transaction value by category
MAX Returns the largest value Highest transaction value by region
COUNT Counts records or non-null values, depending on the field Number of records by category
COUNTD Counts distinct values Number of unique customers by region

Important: The correct aggregation depends on the business question. For example, use SUM(Sales) when comparing total sales, but use AVG(Sales) when comparing average values. A chart can look correct while communicating the wrong result if the aggregation is unsuitable.

19. Filtering Data in a Bar Chart

Filters allow you to focus on selected categories, dates, regions, or ranges of measure values.

Steps to Add a Filter

  1. Create a bar chart.
  2. Drag a field such as Region from the Data pane to the Filters shelf.
  3. Select the values you want to include.
  4. Confirm the filter settings.
  5. Review the chart to ensure it shows the intended subset of data.
  6. If needed, show the filter so viewers can interact with it.

Examples

  • Show sales for the West region only.
  • Compare selected product categories.
  • Display data for a specific year.
  • Focus on products with sales above a selected threshold.

Remember that filters affect which data appears in the view and can influence totals and comparisons.

20. Adding a Trend or Reference Line

Reference lines can help users compare bars against a benchmark, such as the average sales value or a target. Tableau's Analytics pane provides options for adding supported analytical objects.

Example: Compare Sales Against the Average

  1. Create a bar chart of sales by category.
  2. Open the Analytics pane.
  3. Drag a Reference Line into the view and select an appropriate scope, such as Table or Pane.
  4. Choose a measure and aggregation for the reference line.
  5. Configure its label and formatting.
  6. Review which categories are above or below the benchmark.

Business use: A sales manager can quickly identify categories performing above or below the average sales value.

21. Common Problems and Solutions

Problem 1: Tableau Does Not Show a Bar Chart

Possible cause: The field arrangement or mark type is not configured as expected.

Solution: Place a dimension and measure on suitable shelves, select Bar from the Marks card, or use the Show Me panel.

Problem 2: All Categories Show the Same Value

Possible cause: The category field may not be included in the view, or the aggregation may not match the intended comparison.

Solution: Verify the dimension placement, field relationships, aggregation, and data structure.

Problem 3: Bars Are Not Sorted Correctly

Possible cause: The dimension is sorted alphabetically or by another field.

Solution: Configure sorting by the intended measure and select ascending or descending order.

Problem 4: Labels Overlap

Possible cause: The chart contains too many bars or labels.

Solution: Remove unnecessary labels, filter the view, widen the chart, or use tooltips.

Problem 5: Stacked Bars Are Difficult to Compare

Possible cause: Individual segments do not share a common baseline.

Solution: Use a side-by-side bar chart when direct subcategory comparisons are the main objective.

Problem 6: The Axis Makes Differences Look Misleading

Possible cause: The numerical axis uses a non-zero baseline or an unsuitable scale.

Solution: Review the axis settings. For ordinary bar charts, a zero baseline is generally recommended because bar length encodes magnitude.

22. Best Practices for Creating Bar Charts

  • Start with a clear question that the chart should answer.
  • Choose the appropriate dimension and measure.
  • Use horizontal bars for long labels or many categories.
  • Sort categories when ranking is important.
  • Use consistent colors with a clear meaning.
  • Display labels only when they improve readability.
  • Use meaningful titles and axis labels.
  • Keep the numerical axis appropriate for the comparison, usually starting at zero.
  • Use stacked charts to show composition and side-by-side charts to compare subcategory values.
  • Verify the measure aggregation before interpreting results.
  • Avoid unnecessary visual effects and excessive colors.
  • Test the chart at the size at which it will be viewed in a dashboard or report.

23. Practical Project: Sales Analysis Using Bar Charts

Project Objective: Create a Tableau worksheet that helps a business compare sales across product categories and regions.

Required Fields

  • Region
  • Category
  • Sub-Category
  • Sales
  • Profit
  • Order Date

Task A: Sales by Category

  1. Place Category on Columns.
  2. Place Sales on Rows.
  3. Choose Bar as the mark type.
  4. Sort categories by sales.
  5. Add labels if appropriate.

Task B: Sales by Region

  1. Create a new worksheet.
  2. Place Region on Rows.
  3. Place Sales on Columns.
  4. Sort the regions from highest to lowest sales.
  5. Format the axis and title.

Task C: Regional Sales by Category

  1. Create a bar chart using Region and Sales.
  2. Drag Category to Color to create a stacked chart.
  3. Review the contribution of each category.
  4. If direct comparisons of subcategory values are needed, create a side-by-side chart instead.

Task D: Profit by Sub-Category

  1. Place Sub-Category on Rows.
  2. Place Profit on Columns.
  3. Choose Bar as the mark type.
  4. Sort the subcategories by profit.
  5. Look for low or negative profit values.

Task E: Add Filters and Tooltips

  1. Add Order Date or Region to the Filters shelf.
  2. Configure the desired filter values.
  3. Add Profit to Tooltip if it is not already displayed.
  4. Test the filter and tooltip behavior.

Expected Learning Outcomes

  • Create vertical and horizontal bar charts.
  • Compare sales and profit across categories.
  • Use stacked and side-by-side bar chart layouts.
  • Apply sorting, labels, colors, and filters.
  • Explain the business insights shown by the charts.

24. Interview Questions and Answers

Q1. What is a bar chart in Tableau?

Answer: A bar chart uses rectangular bars to represent numerical values across categories. The bar length or height represents the measure value.

Q2. What fields are commonly required to create a bar chart?

Answer: A dimension to define the categories and a measure to provide the numerical values.

Q3. How do you create a vertical bar chart?

Answer: Place a dimension on Columns and a measure on Rows, then select Bar if needed.

Q4. How do you create a horizontal bar chart?

Answer: Place a dimension on Rows and a measure on Columns, then choose Bar if necessary.

Q5. What is a stacked bar chart?

Answer: A stacked bar chart divides each bar into colored segments representing subcategories that contribute to the total.

Q6. What is a side-by-side bar chart?

Answer: It displays bars next to one another for different subcategories within each main category, making direct comparisons easier.

Q7. How can you sort a bar chart by sales?

Answer: Use the sort controls or the dimension's Sort settings to sort by the sales measure in ascending or descending order.

Q8. How can you display values on bars?

Answer: Enable Show Mark Labels on the Marks card or drag the measure to Label.

Q9. What is the difference between a dimension and a measure?

Answer: A dimension categorizes data, while a measure provides a numerical value that can be aggregated.

Q10. Why is aggregation important?

Answer: Aggregation determines the value represented by each bar. An incorrect aggregation can produce a misleading comparison.

Q11. When should you use a 100% stacked bar chart?

Answer: Use it when comparing the percentage composition of categories rather than their absolute totals.

Q12. Why is a zero baseline generally recommended for bar charts?

Answer: Bar length represents magnitude, so a zero baseline helps prevent visual exaggeration of differences.

25. Practice Exercises

  1. Create a vertical bar chart showing Sales by Category.
  2. Create a horizontal bar chart showing Profit by Region.
  3. Sort categories from highest to lowest sales.
  4. Add sales labels to the bars and format the numbers.
  5. Use Color to distinguish categories in a regional sales chart.
  6. Create a stacked bar chart showing category contributions by region.
  7. Create a side-by-side bar chart for comparing categories within regions.
  8. Create a 100% stacked bar chart and verify the percentages.
  9. Add a reference line to compare sales against an average.
  10. Add a Region filter and test how it changes the visualization.
  11. Customize the tooltip to show both Sales and Profit.
  12. Write three business observations based on your completed charts.

26. Quick Revision Notes

  • Bar chart: Compares numerical values across categories.
  • Vertical bar chart: Dimension on Columns and measure on Rows.
  • Horizontal bar chart: Dimension on Rows and measure on Columns.
  • Stacked bar chart: Shows totals and their subcategory composition.
  • Side-by-side bar chart: Compares subcategory values directly.
  • 100% stacked bar chart: Compares proportions of a total.
  • Sorting: Helps identify the highest and lowest values.
  • Labels: Display values directly on bars.
  • Color: Distinguishes groups or represents measure values.
  • Tooltip: Displays supporting information on hover.
  • Aggregation: Determines how measure values are summarized.
  • Zero baseline: Generally recommended for accurate bar-length comparisons.

27. Final Checklist

  • ☐ I understand the purpose of bar charts.
  • ☐ I can create a vertical bar chart.
  • ☐ I can create a horizontal bar chart.
  • ☐ I can create stacked and side-by-side bar charts.
  • ☐ I can create a 100% stacked bar chart.
  • ☐ I can sort bars by a measure.
  • ☐ I can add labels, colors, and tooltips.
  • ☐ I can filter the data displayed in a chart.
  • ☐ I can choose an appropriate aggregation.
  • ☐ I can format a chart for clear communication.
  • ☐ I can explain the business insights shown by a bar chart.

28. Conclusion

Bar charts are among the most useful visualizations in Tableau because they make comparisons between categories straightforward. By learning how to create vertical, horizontal, stacked, side-by-side, and 100% stacked bar charts, you can analyze sales, profit, quantity, and other business measures effectively.

Sorting, labels, colors, filters, tooltips, and correct aggregation make bar charts easier to interpret. Always select a chart structure that matches the business question and keep the visualization clear, accurate, and accessible.

Continue learning through JustAcademy Tableau Training or Register for a Tableau Course Demo.

29. Official References

whatsapp